PATHMac OS 8 and 9 Developer Documentation > Interapplication Communication > AppleScript for Scripters >

AppleScript Language Guide

   

Properties

A property of a value class is a characteristic that is identified by a unique label and has a single value. The "Properties" section of a value class definition describes the property or properties of the class. Simple values have only one property, called Class, which identifies the class of the value. Composite values have both a Class property and at least one additional property, such as Length or Contents.

For example, the value class Boolean, described in Boolean, is a simple class with just one property, the read-only Class property.

class of boolean --result: class

However, the class Date, described in Date, is a composite value class that has additional properties. The following example uses the standard scripting addition command Current Date to get the current date, then gets various properties of the date.

set theDate to current date
--result: date "Wednesday, March 3, 1999 3:01:44 PM"
weekday of theDate --result: Wednesday
day of theDate --result: 3 (the day of the month)

The following example specifies the Length property of a simple list.

length of {"This", "list", "has", 5, "items"} --result: 5

You can optionally use the Get command to get the value of a specified property. For example:

get class of boolean --result: class

In most cases, you can also use the Set command to set the additional properties listed in the definitions of composite values. If a property cannot be set with the Set command, its definition specifies that it is read-only.


© 1999 Apple Computer, Inc. – (Last Updated 21 May 99)